<template>
  <ScrollBar class="menu">
    <el-menu
      active-text-color="#ffd04b"
      background-color="#545c64"
      text-color="#fff"
      :router="true"
      :default-active="defaultActive"
    >
      <el-menu-item v-for="item in list" :key="item.id" :index="item.url">
        <span>{{ item.name }}</span>
      </el-menu-item>
    </el-menu>
  </ScrollBar>
</template>

<script>
/**
 Author: 蒋鑫强
 Time: 2023/6/2
 Description:
 */
import ScrollBar from '@/components/Scrollbar';
import router from '@/util/router';

export default {
  name: 'Menu',

  props: {
    list: {
      type: Array,
      default: () => []
    }
  },

  components: {
    ScrollBar
  },

  data() {
    return {
      defaultActive: router.currentUrl
    };
  }
}
</script>

<style lang="less" scoped>
.menu {
  background: #545c64;

  :deep(.el-menu) {
    border-right: none;
  }
}
</style>
